class ToolUiMgr {

  ui := Map()
  active := ''

  Register(key, ins) => this.ui.Set(key, ins)

  Use(key) {
    if this.active = key
      return
    this.active := key
    if this['x']
      this.ui.Get(key).Move(this.x, this.y)
    for k, v in this.ui
      (k = key) ? v.Show() : v.Hide()
  }

  Move(x, y) {
    if this.active
      this.ui.Get(this.active).Move(x, y)
    this.x := x, this.y := y
  }

  Destroy() {
    for k, v in this.ui
      v.Destroy()
  }
}